home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11011 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: in1.uu.net!interaccess!usenet
  2. From: brianmcg@interaccess.com (Brian V. McGroarty)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Pointer swapping
  5. Date: 21 Mar 1996 14:18:27 GMT
  6. Organization: Internet Squire
  7. Message-ID: <4irofj$2g2@nntp.interaccess.com>
  8. References: <4imjit$oil@pearl.whoi.edu>
  9. Reply-To: brianmcg@interaccess.com
  10. NNTP-Posting-Host: d222.nhe.interaccess.com
  11. X-Newsreader: Internet Squire 1.20
  12.  
  13. mhill wrote:
  14. >I have two int huge arrays with a pointer to each which I use to access and
  15. >assign values. After assigning values to one of the arrays I want to swap
  16. >pointers between the two arrays. 
  17.  
  18. >main()
  19. >   {
  20. >    int ct = 0;
  21. >    do
  22. >    {
  23. >    int huge prtA = A;
  24. >        int huge ptrB = B;
  25. [...]
  26. >   }while
  27.  
  28. >Information seems to be loss when I do this . Shouldn't this work?
  29.  
  30. In the above, prtA and prtB are initialized every time you enter their
  31. scope.  If you move their declarations outside of the do/while loop you
  32. shouldn't have any problem.
  33.  
  34.  
  35.  
  36.  
  37. ---
  38. Brian Valters McGroarty -- brianmcg@bix.com
  39. phone/fax (847) 439-7714
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.